package com.twu.biblioteca.service;

import com.twu.biblioteca.model.bookModel;

/**
 * Created with IntelliJ IDEA.
 * User: st
 * Date: 14-4-16
 * Time: 下午11:03
 * To change this template use File | Settings | File Templates.
 */
public class setup {


    public static bookModel setBook(bookModel bookList1,long id,String bookName,String authorName)
    {   bookList1 = new bookModel();
        bookList1.setBookId(id);
        bookList1.setBookName(bookName);
        bookList1.setAuthorName(authorName);
        bookList1.setCheckStatusFalse();
        return bookList1;
    }

    public static bookModel[] setBookList(bookModel[] bookList){

        bookList[0]=setBook(bookList[0],0001,"Head First Java","KathySierra");
        bookList[1]=setBook(bookList[1],0002,"Matlab","Cao Ge");
        bookList[2]=setBook(bookList[2],0003,"Ado.Net","Tim Patrick");
        return bookList;
    }


    public void printBookList(bookModel bookList1[]){


        int len=0;
        System.out.println("Book Id"+"\t"+"   Book Name"+"\t"+"Author");

        while (len<bookList1.length&&bookList1[len]!=null){
            if(!bookList1[len].getCheckStatus())
            System.out.println(bookList1[len].getBookId()+"        \t"+bookList1[len].getBookName()+"       \t"+bookList1[len].getAuthorName());
            len++;
        }
    }
    public void mainMenu(){
        System.out.println( "\n**************welcome to Biblioteca***************" );

        System.out.println( "             1.Show book list." );

        System.out.println( "             2.Check out book." );
        System.out.println( "             3.Return book." );
        System.out.println( "             4.Show movie list." );

        System.out.println( "             5.Check out movie." );
        System.out.println( "             6.Return movie." );
        System.out.println( "             7.Show my info." );
        System.out.println( "             0.Quit" );

        System.out.println( "*****************************************" );


    }


    }
